{% extends "help/index.html" %}


{% block contentblock %}
    <div class="article">
        <div class="title">
            <div class="title-text">获取资源播放地址<span
                    class="update-time"><i>更新时间:</i><i>2019-11-20</i></span></div>
        </div>
        <div class="content">
            <h2>获取资源播放地址</h2>
            <h3>接口</h3>
            <code>/baidu_dueros/get_video_url</code>
            <h5 id="参数">参数</h5>
            <table>
                <thead>
                <th>位置</th>
                <th>字段名</th>
                <th>类型</th>
                <th>是否必填</th>
                <th>描述</th>
                <th>备注</th>
                </thead>
                <tbody>
                <tr>
                    <td>http header</td>
                    <td>Authorization</td>
                    <td>String</td>
                    <td>是</td>
                    <td>Bearer + 空格 + 生成的用户access token</td>
                    <td></td>
                </tr>
                <tr>
                    <td>http body</td>
                    <td>albumId</td>
                    <td>String</td>
                    <td>是</td>
                    <td>专辑ID</td>
                    <td></td>
                </tr>
                <tr>
                    <td>http body</td>
                    <td>contentId</td>
                    <td>String</td>
                    <td>是</td>
                    <td>资源ID(不使用)</td>
                    <td></td>
                </tr>
                <tr>
                    <td>http body</td>
                    <td>isTrial</td>
                    <td>int</td>
                    <td>否</td>
                    <td>当前用户是否在请求试听内容</td>
                    <td>isTrial=1表示试听,其他为非试听</td>
                </tr>
                <tr>
                    <td>http body</td>
                    <td>preferredAudioFormat</td>
                    <td>String</td>
                    <td>否</td>
                    <td>期望的优先音频格式,取值范围:mp3,mp4</td>
                    <td></td>
                </tr>
                </tbody>
                </table>
                <h4 id="返回值">返回值</h4>

                <h4 id="实例">实例</h4>
                <pre><code>
-- 未登录用户，免费
curl --dump-header - -H "Authorization: Bearer baidu" -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data "{\"albumId\":\"120\",\"contentId\":\"\",\"isTrial\":1,\"preferredAudioFormat\":\"mp3\", \"trackid\":\"120020010\"}" https://wweb.yourhost.com/baidu_dueros/get_video_url
{
    "errno": "0",
    "message": "success",
    "data": {
        "url": "https://video.yourhost.com/videos/static/hello.mp3"
    }
}
-- 登录用户，收费
curl --dump-header - -H "Authorization: Bearer Rj9tsh2nmHRupXckxBCTAM3sPbUgdA" -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data "{\"albumId\":\"12002\",\"contentId\":\"\",\"isTrial\":1,\"preferredAudioFormat\":\"mp3\",\"trackid\":\"12002001\"}" https://wweb.yourhost.com/baidu_dueros/get_video_url
{"errno": "12", "message": "no permission"}
                </code></pre>
        </div>
    </div>
{% endblock contentblock %}